Command line arguments example
AN=SA
Reference
S. Kirkpatrick, C. D. Gelatt Jr, and M. P. Vecchi. (1983).
“Optimization by Simulated Annealing”.
Science. 220 (4598): 671–680.
Pseudocode
- Let $s=s_0$
- For $k\in \{1, \ldots, k_{max}\}$:
- T $\gets$ temperature($\frac{k_{max}}{k}$)
- Pick a random neighbour, $s_{new}\gets$ neighbour($s$)
- If P(E($s$), E($s_{new}$), T) $\leq$ random(0, 1)
- $s \gets s_{new}$
- Output the final state $s$
Class view
class simulated_annealing : public algorithm
Link: algorithm
Added data members
Name |
Type |
Utility |
m_k_max |
size_t |
Maximum number of evalutions |
m_s |
solution<> |
Candidate state (solution) $s$ |
m_s_new |
solution<> |
Neighboring state $s_{new}$ |
Member function
Name |
Utility |
initialize() |
Initialize and evalute $s$ |
run_() |
Optimize $s$ according to Pseudocode 2. |
record() |
Record the number of evaluations and the error (difference of the first objective between the current best solution and the global optima) |
Added member functions
Name |
Utility |
temperature(val) |
The function temperature in Pseudocode 2.1. |
neighbour(s, s_new) |
The function neighbour in Pseudocode 2.2. |
P(s, s_new, T) |
The acceptance probability function P in Pseudocode 2.3. |